package org.redmagic.client.prototype;

import java.net.InetAddress;
import java.util.Properties;

public final class WellKnownPropertyResolver {

	private static final String HOSTNAME = "HOSTNAME";
	private static final String FQDN = "FQDN";
	private static final String IP_ADDRESS = "IP_ADDRESS";
	
	private static Properties wellKnownProperties = new Properties();
	
	static {
		try {
			InetAddress localhost = InetAddress.getLocalHost();
			
			wellKnownProperties.put(HOSTNAME, localhost.getHostName());
			wellKnownProperties.put(FQDN, localhost.getCanonicalHostName());
			wellKnownProperties.put(IP_ADDRESS, localhost.getHostAddress());

		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	public static Properties getWellKnownProperties() {
		// defensive copy
		return new Properties(wellKnownProperties);
	}
}